<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">


<div class="container-fluid">
	<div class="row">
		<div class="panel panel-default">
			<div class="panel-heading">
				<span class="glyphicon glyphicon-th-list" aria-hidden="true"></span> 条件查找
			</div>
			<div class="panel-body">
				<div class="row">
					<div class="col-lg-3 col-sm-8 col-xs-8 col-xxs-12">
						<div class="form-horizontal">
							<div class="form-group">
								<div class="col-md-3 control-label" for="select">结算状态</div>
								<div class="col-md-7">
									<select id="status" name="status" class="form-control">
										<option Value="">全部</option>
										<option Value="1">待入账</option>
										<option Value="2">已入账</option>
										<option Value="3">入账失败</option>
									</select>
								</div>
							</div>
						</div>
					</div>
					<div class="col-lg-3 col-sm-8 col-xs-8 col-xxs-12">
						<div class="form-horizontal">
							<div class="form-group">
								<div class="col-md-3 control-label" for="select">确认状态</div>
								<div class="col-md-7">
									<select id="confirmState" name="confirmState" class="form-control">
										<option Value="">全部</option>
										<option Value="1">未确认</option>
										<option Value="2">已确认</option>
									</select>
								</div>
							</div>
						</div>
					</div>
					<div class="col-lg-3 col-sm-8 col-xs-8 col-xxs-12">
						<div class="form-horizontal">
							<div class="form-group">
								<div class="col-md-3 control-label" for="select">结算时间</div>
								<div class="col-md-7">
									<input type="text" class="form-control" runat="server" id="settlementTime"
										   name="settlementTime" />
								</div>
							</div>
						</div>
					</div>
					<div class="col-lg-3 col-sm-8 col-xs-8 col-xxs-12">
						<div class="form-horizontal">
							<div class="form-group">
								<div class="col-md-3 control-label" for="select">确认时间</div>
								<div class="col-md-7">
									<input type="text" class="form-control" runat="server" id="confirmTime"
										   name="confirmTime" />
								</div>
							</div>
						</div>
					</div>

					<!--查询 按钮-->
				</div>

				<div class="row">
					<div class="col-lg-3 col-sm-8 col-xs-8 col-xxs-12">
						<div class="form-horizontal">
							<div class="form-group">
								<div class="col-md-3 control-label" for="select">打款时间</div>
								<div class="col-md-7">
									<input type="text"  class="form-control" id="paymentTime" name="paymentTime"/>
								</div>
							</div>
						</div>
					</div>
					<div class="col-lg-3 col-sm-8 col-xs-8 col-xxs-12">
						<div class="form-horizontal">
							<div class="form-group">
								<div class="col-md-3 control-label" for="select">流水号</div>
								<div class="col-md-7">
									<input type="text" class="form-control" runat="server" id="settlementNo"
										   name="settlementNo" />
								</div>
							</div>
						</div>
					</div>
					<div class="col-lg-3 col-sm-8 col-xs-8 col-xxs-12">
						<div class="form-horizontal">
							<div class="form-group">
								<div class="col-md-3 control-label" for="select">收入来源</div>
								<div class="col-md-7">
									<select id="dtype" name="dtype" class="form-control">
										<option value="">全部</option>
										<option value="1">广告收入</option>
										<option value="2">分销收入</option>
									</select>
								</div>
							</div>
						</div>
					</div>
					<div class="col-lg-3 col-sm-8 col-xs-8 col-xxs-12">
						<div class="form-horizontal">
							<div class="form-group">
								<div class="col-md-3 control-label" for="select">用户口令</div>
								<div class="col-md-7">
									<input type="text" name="word"  id="word"class="form-control" />
								</div>
							</div>
						</div>
					</div>

				</div>

				<!--查询 按钮-->
			</div>
			</div>
		</div>

		<!--/col-->
	</div>
	<!--/条件查找-->
</div>
	<div class="wrapper wrapper-content ">
		<div class="col-sm-12">
			<div class="ibox">
				<div class="ibox-body">
					<div class="fixed-table-toolbar">
						<div class="columns pull-left">
							<button  type="button" class="btn  btn-success" onclick="reLoadStatus(1)" id="count1">
								待入账
							</button>
							<button  type="button" class="btn  btn-primary" onclick="reLoadStatus(2)" id="count2">
								已入账
							</button>
							<button  type="button" class="btn  btn-default" onclick="reLoadStatus(3)" id="count3">
								入账失败
							</button>
							<button shiro:hasPermission="wallpaper:settlemenbill:add" type="button" onclick="add()" class="btn  btn-primary">
								<i class="fa fa-chain" aria-hidden="true"></i>生成结算单
							</button>
							<button shiro:hasPermission="wallpaper:settlemenbill:add" type="button" onclick="addWallet()" class="btn  btn-primary">
								<i class="fa fa-money" aria-hidden="true"></i>入账钱包
							</button>

							<button shiro:hasPermission="wallpaper:settlemenbill:batchRemove" type="button" class="btn  btn-danger"
								onclick="batchRemove()">
								<i class="fa fa-trash" aria-hidden="true"></i>删除
							</button>
						</div>
						<div class="columns pull-right">
							<button class="btn btn-success" onclick="reLoad()">查询</button>
						</div>
						<div class="columns pull-right">
							<button class="btn btn-default" onclick="restLoad()" style="margin-right: 20px;">重置</button>
						</div>
						<div class="columns pull-right col-md-2 nopadding">

						</div>
					</div>
					<table id="exampleTable" data-mobile-responsive="true">
					</table>
				</div>
			</div>
		</div>
	</div>
	<!--shiro控制bootstraptable行内按钮看见性 来自bootdo的创新方案 -->
		<div>
			<script type="text/javascript">
				var s_edit_h = 'hidden';
				var s_remove_h = 'hidden';
				var s_resetPwd_h = 'hidden';
			</script>
		</div>
		<div shiro:hasPermission="wallpaper:settlemenbill:edit">
			<script type="text/javascript">
				s_edit_h = '';
			</script>
		</div>
		<div shiro:hasPermission="wallpaper:settlemenbill:remove">
			<script type="text/javascript">
				var s_remove_h = '';
			</script>
		</div>
		<div shiro:hasPermission="wallpaper:settlemenbill:resetPwd">
			<script type="text/javascript">
				var s_resetPwd_h = '';
			</script>
		</div>
	</div>
	<div th:include="include :: footer"></div>
	<script type="text/javascript" src="/js/appjs/wallpaper/settlemenbill/settlemenbill.js" th:src="@{/js/appjs/wallpaper/settlemenbill/settlemenbill.js}"></script>

<script th:inline="javascript">
	var platformTypes = [[${platform_type}]];
</script>

	<script>

		layui.use(['upload','laydate'], function () {

			layui.laydate.render({
				elem: '#paymentTime' //指定元素
				,type:'date'
				/*,range: true*/
				,format:'yyyy-MM-dd'//默认格式
				,value: ''//初始默认时间 2020-02-22
				,min: '2017-1-1'
				,max:  0
				,theme: '#393D49'
				,ready: function(date){
					console.log(date); //得到初始的日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
				}
				,change: function(value, date, endDate){
					console.log(value); //得到日期生成的值，如：2017-08-18
				}
				,done: function(value, date, endDate){
					console.log(value); //得到日期生成的值，如：2017-08-18

				}
			});
			layui.laydate.render({
				elem: '#settlementTime' //指定元素
				,type:'date'
				/*,range: true*/
				,format:'yyyy-MM-dd'//默认格式
				,value: ''//初始默认时间 2020-02-22
				,min: '2017-1-1'
				,max:  0
				,theme: '#393D49'
				,ready: function(date){
					console.log(date); //得到初始的日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
				}
				,change: function(value, date, endDate){
					console.log(value); //得到日期生成的值，如：2017-08-18
				}
				,done: function(value, date, endDate){
					console.log(value); //得到日期生成的值，如：2017-08-18

				}
			});
			layui.laydate.render({
				elem: '#confirmTime' //指定元素
				,type:'date'
				/*,range: true*/
				,format:'yyyy-MM-dd'//默认格式
				,value: ''//初始默认时间 2020-02-22
				,min: '2017-1-1'
				,max:  0
				,theme: '#393D49'
				,ready: function(date){
					console.log(date); //得到初始的日期时间对象：{year: 2017, month: 8, date: 18, hours: 0, minutes: 0, seconds: 0}
				}
				,change: function(value, date, endDate){
					console.log(value); //得到日期生成的值，如：2017-08-18
				}
				,done: function(value, date, endDate){
					console.log(value); //得到日期生成的值，如：2017-08-18

				}
			});

			let submit = false;
			//生成结算单
			$("#add").click(function (){
				if(submit){
					console.log(999);
					return;
				}
				//loding状态
				var loading = layer.load(2, { //icon支持传入0-2
					shade: [0.3, 'gray'], //0.5透明度的灰色背景
					content: '生成中...',
					success: function (layero) {
						layero.find('.layui-layer-content').css({
							'padding-top': '39px',
							'width': '60px'
						});
					}
				});
				submit = true;
				$.ajax({
					cache : true,
					type : "POST",
					url : ctxPath+"/wallpaper/settlemenbill/addSettlemenbill",
					data : {},
					async : false,
					error : function(request) {
						layer.alert("Connection error");
					},
					success : function(data) {
						submit = false;
						if (data.code == 0) {
							layer.msg("操作成功");
							layer.close(loading);
							reLoad();
						} else {
							layer.alert(data.msg)
						}
					},error:function (){
						submit = false;
					}
				});
			})

		})



	</script>

</body>
</html>